using Microsoft.Phone.Controls.Primitives;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
namespace Microsoft.Phone.Controls
{
	public class TimePickerPage : DateTimePickerPageBase
	{
		internal VisualStateGroup VisibilityStates;
		internal VisualState Open;
		internal VisualState Closed;
		internal PlaneProjection PlaneProjection;
		internal Rectangle SystemTrayPlaceholder;
		internal LoopingSelector PrimarySelector;
		internal LoopingSelector SecondarySelector;
		internal LoopingSelector TertiarySelector;
		private bool _contentLoaded;
		public TimePickerPage()
		{
			this.InitializeComponent();
			this.PrimarySelector.DataSource = (DateTimeWrapper.CurrentCultureUsesTwentyFourHourClock() ? new TwentyFourHourDataSource() : new TwelveHourDataSource());
			this.SecondarySelector.DataSource = new MinuteDataSource();
			this.TertiarySelector.DataSource = new AmPmDataSource();
			base.InitializeDateTimePickerPage(this.PrimarySelector, this.SecondarySelector, this.TertiarySelector);
		}
		protected override IEnumerable<LoopingSelector> GetSelectorsOrderedByCulturePattern()
		{
			return DateTimePickerPageBase.GetSelectorsOrderedByCulturePattern(CultureInfo.get_CurrentCulture().get_DateTimeFormat().get_LongTimePattern().ToUpperInvariant(), new char[]
			{
				'H',
				'M',
				'T'
			}, new LoopingSelector[]
			{
				this.PrimarySelector,
				this.SecondarySelector,
				this.TertiarySelector
			});
		}
		protected override void OnOrientationChanged(OrientationChangedEventArgs e)
		{
			if (e == null)
			{
				throw new ArgumentNullException("e");
			}
			base.OnOrientationChanged(e);
			this.SystemTrayPlaceholder.set_Visibility(((1 & e.get_Orientation()) != null) ? 0 : 1);
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/Microsoft.Phone.Controls.Toolkit;component/DateTimePickers/TimePickerPage.xaml", 2));
			this.VisibilityStates = (VisualStateGroup)base.FindName("VisibilityStates");
			this.Open = (VisualState)base.FindName("Open");
			this.Closed = (VisualState)base.FindName("Closed");
			this.PlaneProjection = (PlaneProjection)base.FindName("PlaneProjection");
			this.SystemTrayPlaceholder = (Rectangle)base.FindName("SystemTrayPlaceholder");
			this.PrimarySelector = (LoopingSelector)base.FindName("PrimarySelector");
			this.SecondarySelector = (LoopingSelector)base.FindName("SecondarySelector");
			this.TertiarySelector = (LoopingSelector)base.FindName("TertiarySelector");
		}
	}
}
